<?php #//v.3.3.0
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";
include $include_path.'time.inc.php';
include $include_path.'dates.inc.php';

unset($ERR);

#//Default for error message (blank)

#// Edit the board
if($_POST['action'] == "update" && phpa_securepost($_POST)) {
	if(empty($_POST[name]) ||
	empty($_POST[msgstoshow]) ||
	empty($_POST[active])) {
		$ERR = $ERR_047;
	} elseif(!ereg("^[0-9]+$",$_POST[msgstoshow])) {
		$ERR = $ERR_5000;
	} elseif(intval($_POST[msgstoshow] == 0)) {
		$ERR = $ERR_5001;
	} else {
		$query = "UPDATE PHPAUCTIONXL_community
					  SET
					  name='".addslashes($_POST[name])."',
					  msgstoshow=".intval($_POST[msgstoshow]).",
					  active=".intval($_POST[active])."
					  WHERE id=".intval($_POST[id]);
		$res = @mysql_query($query);
		if(!$res) {
			print "Error: $query<BR>".mysql_error();
			exit;
		} else {
			Header("Location: boards.php");
			exit;
		}
	}
}
#// Retrieve board's data from the database
$query = "SELECT * FROM PHPAUCTIONXL_community WHERE id=".$_REQUEST['id'];
$res_ = @mysql_query($query);
if(!$res_) {
	print "Error: $query<BR>".mysql_error();
	exit;
} else {
	$BOARD = mysql_fetch_array($res_);
}

?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<FORM NAME="editboard" METHOD="post" ACTION="<?=basename($_SERVER['PHP_SELF'])?>">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/content_icon2.gif" width="28" height="27" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_25_0018?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_5032?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle"> 
	<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER">
	<TD>
        <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER" class="base"  style="border:1px solid #ccc;">
          <TR>
            <TD COLSPAN="2" class=title>
               <p> <?=$MSG_5052?></p>
            </TD>
          </TR>
          <?
          if(isset($ERR))
          {
		  ?>
          <TR>
            <TD COLSPAN="2" class="error">
              <p><? print $ERR; ?></p>
              </TD>
          </TR>
          <?
          }
		  ?>
          <TR>
            <TD WIDTH="17%" class="lineV gris">
		  <p><?=$MSG_5034?></p>
            </TD>
            <TD class="gris">
              <INPUT TYPE="text" NAME="name" SIZE="25" MAXLENGTH="255" VALUE="<?=$BOARD[name]?>">
            </TD>
          </TR>
          <TR BGCOLOR="#FFFFFF">
            <TD WIDTH="17%" class="lineV">
              
			 <p class="blue"> <?=$MSG_5043?></p>
            </TD>
            <TD> 
				<B>
              <?=$BOARD[messages]?>
              </B> &nbsp;&nbsp;
              <?
              if($BOARD[messages] > 0)
              {
			  ?>
              &nbsp;&nbsp;&nbsp;<img src="images/ball.gif" width="12" height="12"><img src="images/ball.gif" width="12" height="12">&nbsp;<a href="editmessages.php?id=<?=$_REQUEST['id']?>">
              <?=$MSG_5063?>
              </a>
              <?
              }
			  ?>
            </TD>
          </TR>
          <TR>
            <TD WIDTH="17%" class="gris lineV">
			 <p class="blue"> <?=$MSG_5053?></p>
            </TD>
            <TD class="gris">
              <?
              if($BOARD[lastmessage]) {
              	print FormatDate($BOARD[lastmessage]);
              } else {
              	print "--";
              }
			  ?>
            </TD>
          </TR>
          <TR>
            <TD WIDTH="17%"class="lineV"><p class="blue"><?=$MSG_5035?></p></TD>
            <TD>
			  <?=$MSG_5036?>
              <BR>
              <INPUT TYPE="text" NAME="msgstoshow" SIZE="4" MAXLENGTH="4" VALUE="<?=$BOARD[msgstoshow]?>">
            </TD>
          </TR>
          <TR BGCOLOR="#FFFFFF">
            <TD WIDTH="17%" class="gris lineV">
			  <p class="blue"><?=$MSG_5054?></p>
            </TD>
            <TD  class="gris">
              <INPUT TYPE="radio" NAME="active" VALUE="1"
			  <?
			  if($BOARD[active] == 1)
			  {
			  	print " CHECKED";
			  }
			  ?>
			  >
			  <?=$MSG_5038?>
              <INPUT TYPE="radio" NAME="active" VALUE="2"
			  <?
			  if($BOARD[active] == 2)
			  {
			  	print " CHECKED";
			  }
			  ?>
			  >
			  <?=$MSG_5039?>
            </TD>
          </TR>
          <TR>
            <TD WIDTH="17%" class="lineV">
              <INPUT TYPE="hidden" NAME="action" VALUE="update" /> <INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />
              <INPUT TYPE="hidden" NAME="id" VALUE="<?=$_REQUEST['id']?>">
            </TD>
            <TD>
              <INPUT TYPE="submit" NAME="Submit" VALUE="<?=$MSG_5029?>" class="action">
            </TD>
          </TR>
        </TABLE>
			</TD>
		</TR>
	</TABLE>
	</TD>
	</TR>
	</TABLE>
</FORM>
</BODY>
</HTML>